
import java.util.Scanner;
// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main
{
    public static void main(String[] args)
    {
        Scanner in = new Scanner(System.in);
        char[] a = in.next().toCharArray();
        char[] b = in.next().toCharArray();
        int m = a.length, n = b.length;
        int ret = m;
        for(int i = 0; i <= n - m; i++)  {// 枚举 b 的起始位置
            int tmp = 0;
            for(int j = 0; j < m; j++) {
                if(a[j] != b[i + j]) {
                    tmp++;
                }
            }
        ret = Math.min(ret, tmp);
    }
        System.out.println(ret);
    }
}
